<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" th:href="@{/static/assets/images/favicon.png}" type="image/png">
    <title>首页</title>

    <!--Begin  Page Level  CSS -->
    <link th:href="@{/static/assets/plugins/morris-chart/morris.css}" rel="stylesheet">
    <link th:href="@{/static/assets/plugins/jquery-ui/jquery-ui.min.css}" rel="stylesheet"/>
    <!--End  Page Level  CSS -->
    <!-- BEGIN PAGE LEVEL STYLES -->
    <link th:href="@{/static/assets/plugins/datatables/css/jquery.datatables.min.css}" rel="stylesheet"
          type="text/css"/>
    <link th:href="@{/static/assets/plugins/datatables/css/jquery.dataTables-custom.css}" rel="stylesheet"
          type="text/css"/>
    <!-- END PAGE LEVEL STYLES -->
    <link th:href="@{/static/assets/css/icons.css}" rel="stylesheet">
    <link th:href="@{/static/assets/css/bootstrap.min.css}" rel="stylesheet">
    <link th:href="@{/static/assets/css/style.css}" rel="stylesheet">
    <link th:href="@{/static/assets/css/responsive.css}" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="js/html5shiv.min.js"></script>
    <script src="js/respond.min.js"></script>
    <![endif]-->

</head>

<body class="sticky-header">


<div th:include="left-side-menu"></div>


<!-- main content start-->
<div class="main-content">

    <!-- header section start-->
    <div class="header-section" th:include="header">
    </div>
    <!-- header section end-->


    <!--body wrapper start-->
    <div class="wrapper">

        <!--Start Page Title-->
        <div class="page-title-box">
            <h4 class="page-title">首页 </h4>
            <ol class="breadcrumb">
                <li>
                    <a href="#">首页</a>
                </li>

                <li class="active">
                    用户管理
                </li>
            </ol>
            <div class="clearfix"></div>
        </div>
        <!--End Page Title-->

        <!--Start row-->
        <div class="row">
            <div class="container">
                <div class="analytics-box">

                </div>
            </div>
        </div>
        <!--End row-->

        <!--Start row-->
        <div class="row">
            <div class="col-md-12">
                <div class="white-box">
                    <h2 class="header-title">用户管理</h2>
                    <div class="table-responsive">
                        <table id="example" class="display table">
                            <thead>
                            <tr>
                                <th></th>
                                <th>用户名</th>
                                <th>类型</th>
                                <th>电话</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr th:each="user,userStat : ${userList}">
                                <td th:text="${userStat.index +  1}"></td>
                                <td th:text="${user.username}"></td>
                                <td th:text="${user.type == 'ADMIN' ? '管理员' : '会员'}"></td>
                                <td th:text="${user.tel}"></td>
                                <td><button th:onclick="delUser([[${user.username}]])">删除</button></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <!--End row-->

    </div>
    <!-- End Wrapper-->


    <!--Start  Footer -->
    <footer class="footer-main">Copyright &copy; 2021.LeTui Pricng All rights reserved.<a target="_blank" href="#">乐推定价网站</a>
    </footer>
    <!--End footer -->

</div>
<!--End main content -->


<!--Begin core plugin -->
<script th:src="@{/static/assets/js/jquery.min.js}"></script>
<script th:src="@{/static/assets/js/bootstrap.min.js}"></script>
<script th:src="@{/static/assets/plugins/moment/moment.js}"></script>
<script th:src="@{/static/assets/js/jquery.slimscroll.js}"></script>
<script th:src="@{/static/assets/js/jquery.nicescroll.js}"></script>
<script th:src="@{/static/assets/js/functions.js}"></script>
<!-- End core plugin -->

<!--Begin Page Level Plugin-->
<!--<script th:src="@{/static/assets/plugins/morris-chart/morris.js}"></script>-->
<!--<script th:src="@{/static/assets/plugins/morris-chart/raphael-min.js}"></script>-->
<!--<script th:src="@{/static/assets/plugins/jquery-sparkline/jquery.sparkline.min.js}"></script>-->
<!--<script th:src="@{/static/assets/pages/dashboard.js}"></script>-->
<!--End Page Level Plugin-->

<!--Begin Page Level Plugin-->
<script th:src="@{/static/assets/plugins/datatables/js/jquery.datatables.min.js}"></script>
<script th:src="@{/static/assets/pages/table-data.js}"></script>
<!--End Page Level Plugin-->
<script>
    function delUser(username) {
        if (confirm("确认删除用户：" + username + "？（操作不可逆）")) {
            window.location.href = '/admin/del/' + username;
        }
    }
</script>
</body>

</html>
